<template>
	<view>
		<view class="logo">
			<image mode="widthFix" src="@/static/images/other/logo.png"></image>
		</view>
		<view class="name">
			<view>背单词</view>
		</view>
		<view class="loading">
			<image mode="widthFix" src="@/static/images/other/load2.gif"></image>
		</view>
		
		<!-- 提示信息弹窗 -->
		<popup ref="popup"></popup>
	</view>
</template>

<script>
	import {login} from "@/api/loginApi.js";
	import popup from "@/components/popup.vue";
	export default {
		components:{popup},
		data() {
			return {
				themeColor:"",
				themeColorLess:"",
			};
		},
		methods:{
			
		},
		mounted() {
			uni.login({ 
				"provider": "weixin",
				"onlyAuthorize": true, // 微信登录仅请求授权认证
				success: async function(event){
					const {code} = event
					//客户端成功获取授权临时票据（code）,向业务服务器发起登录请求。
					let res = await login(code);
					console.log("res",res);
				},
				fail: function (err) {
			        console.log("授权错误",err)
			    }
			});
		},
		onLoad(){
			//获取主题颜色
			let color = uni.getStorageSync("color");
			this.themeColor = JSON.parse(color).themeColor;
			this.themeColorLess = JSON.parse(color).themeColorLess;
		},
	}
</script>

<style lang="scss">
	.logo{
		display: flex;
		justify-content: center;
		align-items: center;
		
		image{
			width: 200rpx;
		}
	}
	
	.name{
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 10rpx;
		position: relative;
		z-index: 100;
		view{
			font-size: 28rpx;
			font-weight: 600;
		}
	}
	
	.loading{
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: -60rpx;
		position: relative;
		z-index: 1;
		image{
			width: 280rpx;
		}
	}
</style>
